<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" value="浪起来" @click="start">
        <input type="button" value="停止" @click="stop">

        <h3>{{ msg }}</h3>
    </div>

    <script>
        var vm = new Vue({
            data: {
                msg: '我拿Buff,谢谢~',
                time: null
            },
            methods: {
                start() {
                    if (this.time !== null) return
                    this.time = setInterval(() => {
                        const a = this.msg.slice(0, 1)
                        const b = this.msg.slice(1)
                        this.msg = b + a
                    }, 500)
                },
                stop() {
                    clearInterval(this.time)
                    this.time = null
                }

            }
        }).$mount('#app')
    </script>
</body>

</html>